package com.acwing.lc.part1;

/**
 * @author rkc
 * @date 2022/9/15 9:07
 */
public class LC45跳跃游戏II {

    public int jump(int[] nums) {
        int n = nums.length;
        int[] f = new int[n + 10];
        for (int i = 1; i < f.length; i++) f[i] = 0x3f3f3f3f;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j <= i + nums[i] && j < f.length; j++) {
                f[j] = Math.min(f[j], f[i] + 1);
            }
        }
        return f[n - 1];
    }
}
